home *** CD-ROM | disk | FTP | other *** search
- Path: news.halcyon.com!usenet
- From: normanb@halcyon.com (Norm Bryar)
- Newsgroups: comp.lang.c++
- Subject: Re: Need help with far pointers to struct in .h file
- Date: Fri, 08 Mar 1996 15:41:22 GMT
- Organization: Northwest Nexus Inc.
- Message-ID: <4hpkdp$sr0@news.halcyon.com>
- References: <4hd5bg$cvd@bert.compusmart.ab.ca>
- NNTP-Posting-Host: blv-pm3-ip14.halcyon.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- cpettica@compusmart.ab.ca (Chris) wrote:
-
- >When I try to run my program I get a general protection exception. It dies
- >in this function, which of course is the first one called when I select
- >checkers. I have marked the line, which is the first line executed.
-
- >Do I have to declare the array somewhere(WM_CREATE ??) in the cpp file?
-
-
- >void fnInitCheckerArray(LPARAM lParam)
- >{
- > GAMEDATA far * lPtr;
- > lPtr = (GAMEDATA far *)lParam;
-
- > for (int iRow = 0; iRow < CHECKER_ROWS; iRow++)
- > for(int iColumn = 0; iColumn < CHECKER_COLUMNS; iColumn++)
- > {
- > if ((iRow + iColumn)%2)
- > {
- > if(iRow < 3)
- > lPtr->aiCheckerArray[iRow][iColumn] = 1;
- > else if (iRow > 4)
- > lPtr->aiCheckerArray[iRow][iColumn] = 2;
- > else
- > lPtr->aiCheckerArray[iRow][iColumn] = 0;
- > }
- > else
- >----------------->>>>>> lPtr->aiCheckerArray[iRow][iColumn] = -1;
- > }
- > return;
- >}
-
-
- >Thanks in advance
- >Chris
-
- O.K., it dies on the first access of lPtr->aiCheckerArray, iRow =
- iColumn = 0? It very much sounds like either lParam isn't pointing to
- a real GAMEDATA or if it does point to a GAMEDATA, the aiCheckerArray
- wasn't properly allocated.
-
- Where did lParam come from, was it passed through to WM_CREATE, which
- I assume is the fnInitCheckerArray caller, by CreateWindowParam()?
-
- --Norm
-
-